#!/bin/bash
DATE=`date +"%s"`
cd /home/minecraft
tar -pcvzf /backup/data/private_server/server-${DATE}.tar.gz *

cd /backup/data/private_server
for i in `ls -1rt|tail -1`;do
    cp $i /media/KINGSTON/private_server/
done

if [[ `find /media/KINGSTON/private_server -name "*tar.gz"|wc -l` > 12 ]];then
    find /media/KINGSTON/private_server -mtime +3 -exec rm {} ';'
fi
